package com.example.cursor_orm.model;

import java.time.LocalDateTime;

/**
 * 用户模型类
 * 对应数据库表: user
 */
public class User {
    private Integer id;
    private String username;
    private String passwordHash;
    private String salt;
    private String realName;
    private UserType userType;
    private String studentNo;
    private String staffNo;
    private String dept;
    private String grade;

    private LocalDateTime createdAt;

    // 枚举定义
    public enum UserType {
        学生, 教师, 管理员
    }

    // 构造函数
    public User() {}

    public User(String username, String passwordHash, String salt, UserType userType) {
        this.username = username;
        this.passwordHash = passwordHash;
        this.salt = salt;
        this.userType = userType;
    }

    // Getter和Setter方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPasswordHash() {
        return passwordHash;
    }

    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public UserType getUserType() {
        return userType;
    }

    public void setUserType(UserType userType) {
        this.userType = userType;
    }

    public String getStudentNo() {
        return studentNo;
    }

    public void setStudentNo(String studentNo) {
        this.studentNo = studentNo;
    }

    public String getStaffNo() {
        return staffNo;
    }

    public void setStaffNo(String staffNo) {
        this.staffNo = staffNo;
    }

    public String getDept() {
        return dept;
    }

    public void setDept(String dept) {
        this.dept = dept;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }



    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public String toString() {
        return "User{" +
               "id=" + id +
               ", username='" + username + '\'' +
               ", realName='" + realName + '\'' +
               ", userType=" + userType +
               ", studentNo='" + studentNo + '\'' +
               ", staffNo='" + staffNo + '\'' +
               ", dept='" + dept + '\'' +
               ", grade='" + grade + '\'' +
               ", createdAt=" + createdAt +
               '}';
    }
} 